import ConfigAPI from '@/api/message/config.api';
export default function useTableData() {
  const tableData = ref([]);
  const pageInfo = ref({
    pageNum: 1,
    pageSize: 10,
    total: 0,
  });
  const loadData = async (flag?: number, filterForm?: any) => {
    if (flag) {
      pageInfo.value.pageNum = flag;
    }
    const ret: any = await ConfigAPI.getTemplateList({
      ...filterForm,
      pageNum: pageInfo.value.pageNum,
      pageSize: pageInfo.value.pageSize,
    });
    tableData.value = ret.records;
    pageInfo.value = {
      pageNum: ret.pageNum,
      pageSize: ret.pageSize,
      total: ret.total,
    };
    return {
      tableData,
      pageInfo,
    };
  };
  return {
    tableData,
    loadData,
    pageInfo,
  };
}
